package com.heima.wemedia.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.mapper.WmChannelMapper;
import com.heima.wemedia.service.WmChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Xiao
 * @version 1.0
 * @description
 * @date 2021/11/22
 */
@Service
@Slf4j
public class WmChannelServiceImpl
        extends ServiceImpl<WmChannelMapper, WmChannel>
        implements WmChannelService {
    /**
     * 自媒体文章管理-频道列表
     * @return
     */
    @Override
    public ResponseResult getChannels() {
        LambdaQueryWrapper<WmChannel> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByAsc(WmChannel::getOrd).orderByDesc(WmChannel::getCreatedTime);
        List<WmChannel> list = this.list(wrapper);
        if (CollUtil.isEmpty(list)) {
            list = new ArrayList<>();
        }
        return ResponseResult.okResult(list);
    }

    /**
     * 查询频道列表
     * @param dto
     * @return
     */
    @Override
    public Page getChannelList(SensitiveDto dto) {
        return null;
    }

    /**
     * 删除频道
     * @param id
     * @return
     */
    @Override
    public ResponseResult delChannel(Integer id) {
        return null;
    }

    /**
     * 添加频道
     * @param adSensitive
     * @return
     */
    @Override
    public ResponseResult saveChannel(WmSensitive adSensitive) {
        return null;
    }

    /**
     * 修改频道
     * @param adSensitive
     * @return
     */
    @Override
    public ResponseResult updateChannel(WmSensitive adSensitive) {
        return null;
    }
}
